jQuery(document).ready(function(e){var t=true;var n=wp.media.editor.send.attachment;e("input.upload_button").click(function(r){var i=e(this).prev("input").attr("id");var s=wp.media.editor.send.attachment;var o=e(this);t=true;wp.media.editor.send.attachment=function(r,s){if(t){e("#"+i).val(s.url)}else{return n.apply(this,[r,s])}};wp.media.editor.open(o);return false});jQuery(".add_media").on("click",function(){t=false})})